home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
PROGRAMMING
/
DESKLIBC
/
SOURCES.ZIP
/
DeskLib
/
!DLSources
/
Libraries
/
KernelSWIs
/
c
/
ReadVarVal
Wrap
Text File
|
1995-07-08
|
1KB
|
45 lines
/*
#### # # # #
# # # # # The FreeWare C library for
# # ## ### # # # # ### RISC OS machines
# # # # # # # # # # # ___________________________________
# # #### ### ## # # # #
# # # # # # # # # # Please refer to the accompanying
#### ### #### # # ##### # ### documentation for conditions of use
________________________________________________________________________
File: KernelSWIs.ReadVarVal.c
Author: Copyright © 1994 Tim Browse
Version: 1.00 (30 May 1994)
Purpose: Function to read an environment variable's value.
*/
#include "DeskLib:Core.h"
#include "DeskLib:KernelSWIs.h"
#include "DeskLib:SWI.h"
extern BOOL OS_ReadVarVal(char *varname, char *buf, int bufsize)
{
int result;
/* Check for existence of this system variable */
SWI(3, 3, SWI_OS_ReadVarVal, varname, buf, -1, NULL, NULL, &result);
if (result < 0)
{
/* Variable exists - read it and use text for file description */
SWI(5, 3, SWI_OS_ReadVarVal,
varname, buf, bufsize, 0, 0,
NULL, NULL, &result);
/* Ensure correct termination */
buf[result] = 0;
return TRUE;
}
/* Could not find it */
return FALSE;
}